﻿// JavaScript Document
pageModel.setPageSize(10);

var formApp= angular.module('formApp',[]);
formApp.controller('formController',function($scope){
	
	$scope.formData = {};	
	$scope.productInfo = {};
	
	//加载管理员信息	
	$scope.loadAdmin = function(direction)
	{		
		 
		if(direction == 2) pageModel.lastPage();
		else if(direction == 1) pageModel.nextPage();
		else if(direction == -1) pageModel.prevPage();
		else if(direction == -2) pageModel.firstPage();
		
		$scope.start = pageModel.getStart();
		$scope.limit = pageModel.getLimit();
		
		$("#grid-loading").show();
			
		
		$http.post(SGA.webroot + 'employee/EmployeeAction!list', {start:$scope.start, limit:$scope.limit}, {
			headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
			transformRequest: function(data) {
				var qry = angular.isObject(data) && String(data) !== '[object File]' ? requestParam(data) : data;
				return qry;
			}
		}).success(function(data) {
			if (data.success == 'true') {
				$scope.employees = data.rows;
				$("#grid-loading").hide();
				if($scope.sCount<=0)
				{
					alert("没有数据！");
				}
				$scope.sCount = data.totalCount;
				pageModel.setTotalRecordCount($scope.sCount);
				$("#pageMsg").html(pageModel.getMsg() + "，共【" + $scope.sCount + "】条记录。" );
			}
			else {
				alert(data.msg);
				$("#grid-loading").hide();
			}
		}).error(function(data) {
			alert('网络异常!');
		});
		 
	}	


});